package com.hsogoo.collate.datasource;

import com.google.common.collect.Maps;
import com.hsogoo.collate.domain.DataSourceConfig;

import javax.sql.DataSource;
import java.util.HashMap;
import java.util.Map;

/**
 * 保持所有的数据源
 * @Author huangsaigang
 * Created @2019-10-25.
 */
public class DataSourceHolder {

    private static Map<String, DataSource> dataSourceMap = Maps.newHashMap();

    public static void addDataSource(String name, DataSource dataSource){
        dataSourceMap.put(name, dataSource);
    }

    public static DataSource getDataSource(String name){
        return dataSourceMap.get(name);
    }

    public static Map<String, DataSource> getDataSources(){
        return dataSourceMap;
    }

}
